<template>
	<view>
		<cu-custom :isBack="true">
			<block slot="backText">返回</block>
			<block slot="content">联系我们</block>
		</cu-custom>
		<view class="bg-white radius shadow-blur margin">
			<view class="flex justify-start align-start padding solid-bottom"
				style="flex-direction: column;width: 100%;">
				<view class="flex justify-between align-center" style="width: 100%;">
					<view class="text-lg text-black">技术支持:</view>
					<text @tap="showExpandMenuAction($event,techMobile)" class="text-lg">微信/电话:{{techMobile}}</text>
				</view>
			</view>
			<view class="flex justify-start align-start padding" style="flex-direction: column;width: 100%;">
				<view class="flex justify-between align-center" style="width: 100%;">
					<view class="text-lg text-black">产品支持:</view>
					<text @tap="showExpandMenuAction($event,infoMobile)" class="text-lg">微信/电话:{{infoMobile}}</text>
				</view>
			</view>
		</view>
		<!-- #ifdef MP-WEIXIN -->
		<view class="flex justify-center align-center padding-top" style="width: 100%;">
			<button open-type="contact" style="width: 50%;" class="bg-green cu-btn"><text
					class="cuIcon-communityfill text-white"><text class="padding-left-xs">立即咨询</text></text></button>
		</view>
		<!-- #endif -->
		<chunLei-popups v-model="popMore.showExpandMenu" :x="popMore.x" :y="popMore.y" dynamic>
			<view
				:class="'flex align-center justify-start '+[index!==popMore.expandMenuList.length-1?'padding-bottom-sm':'']"
				style="flex-direction: column;" v-for="(item,index) in popMore.expandMenuList" :key="index">
				<view @tap="tapPopup(index)" class="flex justify-start align-center">
					<text :class="'padding-right-xs cuIcon-'+item.icon"></text>
					<text class="text-df">{{item.title}}</text>
				</view>
			</view>
		</chunLei-popups>
	</view>
</template>

<script>
	import chunLeiPopups from "@/components/chunLei-popups/chunLei-popups.vue";
	import config from '@/api/config.js'
	import {
		logout
	} from '@/api/auth.js'
	export default {
		components: {
			chunLeiPopups
		},
		data() {
			return {
				mobile: null,
				popMore: {
					x: 30,
					y: 50,
					showExpandMenu: false,
					expandMenuList: [{
							title: '拨打电话',
							icon: 'phone'
						},
						{
							title: '复制号码',
							icon: 'copy'
						}
					],
				}
			}
		},
		computed: {
			techMobile() {
				return config.techMobile
			},
			infoMobile() {
				return config.infoMobile
			}
		},
		methods: {
			tapPopup(index) {
				if (index == 0) {
					this.callMobile()
				} else if (index == 1) {
					this.copyMobile()
				}
			},
			showExpandMenuAction(e, mobile) {
				this.mobile = mobile
				this.popMore.x = e.touches[0].clientX
				this.popMore.y = e.touches[0].clientY
				this.popMore.showExpandMenu = !this.popMore.showExpandMenu
			},
			copyMobile() {
				if (this.mobile == null) {
					return
				}
				uni.setClipboardData({
					data: this.mobile,
					success: function() {
						uni.showToast({
							icon: 'none',
							title: '已复制!'
						});
					}
				});
			},
			callMobile() {
				if (this.mobile == null) {
					return
				}
				uni.makePhoneCall({
					phoneNumber: this.mobile
				})
			}
		}
	}
</script>

<style>

</style>
